# -*- coding: utf-8 -*-

from dramkit import simple_logger
from dramkit.gentools import catch_error, capture_print
logger = simple_logger()
logger = simple_logger('./catch_error_test.log')


@catch_error(logger)
def test_error():
    print('test_error...') 
    raise ValueError('test raise')

    
@catch_error()
def test_error1(logger=None):
    print('test_error1...')
    raise ValueError('test raise1')

    
@catch_error(simple_logger(logname='test'))
@capture_print()
def test_error2(logger=None):
    print('test_error2...')

    
@catch_error(False)
def test_error3(logger=None):
    print('test_error3...')
    raise ValueError('test raise3')
    

def test_error0():
    print('test_error...') 
    raise ValueError('test raise')
    
    
@catch_error(logger)
def test_error00():
    test_error0()
    
    
def test000():
    test_error00()


if __name__ == '__main__':
    # test_error()
    # test_error1()
    # test_error2()    
    # test_error3() 
    test000()